
cmake_minimum_required(VERSION 3.10.2)

project("player")

set(FFMPEG ${CMAKE_SOURCE_DIR}/ffmpeg)
set(RTMP ${CMAKE_SOURCE_DIR}/rtmp)

include_directories(${FFMPEG}/include)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${FFMPEG}/libs/${CMAKE_ANDROID_ARCH_ABI}")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${RTMP}/libs/${CMAKE_ANDROID_ARCH_ABI}")

#批量导入源文件
file(GLOB src_files *.cpp)

add_library( # Sets the name of the library.
             native-lib#总库 libnative-lib.so

             # Sets the library as a shared library.
             SHARED#动态库

             # Provides a relative path to your source file(s).
             native-lib.cpp )


find_library( # Sets the name of the path variable.
              log-lib

              # Specifies the name of the NDK library that




              # you want CMake to locate.
              log



        )



target_link_libraries( # Specifies the target library.
                       native-lib

                       # Links the target library to the log library


                        -Wl,--start-group
                        avcodec avfilter avformat avutil swresample swscale
                        -Wl,--end-group

                        # included in the NDK.
                       ${log-lib}

                        log
                        z #libz.so库，是FFmpeg需要ndk的z库，FFmpeg需要额外支持
                        rtmp
                        android #android 后面会专门介绍，目前先要明白的是ANativeWindow用来渲染画面的
                        OpenSLES #OpenSLES用来播放声音的，

        )